#ifndef SETTINGSMANAGER_H
#define SETTINGSMANAGER_H

#include <QtCore/QObject>
#include <QtCore/QSettings>
#include <QtCore/QString>

class SettingsManager : public QObject
{
    Q_OBJECT

public:
    explicit SettingsManager(QObject *parent = nullptr);
    ~SettingsManager();

    // 下载设置
    int maxConcurrentDownloads() const;
    void setMaxConcurrentDownloads(int max);
    
    int downloadSpeedLimit() const;
    void setDownloadSpeedLimit(int limit); // KB/s, 0表示无限制
    
    QString defaultDownloadPath() const;
    void setDefaultDownloadPath(const QString &path);
    
    bool useProxy() const;
    void setUseProxy(bool use);
    
    QString proxyHost() const;
    void setProxyHost(const QString &host);
    
    int proxyPort() const;
    void setProxyPort(int port);
    
    // 重试设置
    int maxRetries() const;
    void setMaxRetries(int maxRetries);
    
    // 用户界面设置
    bool showNotificationOnComplete() const;
    void setShowNotificationOnComplete(bool show);
    
    bool startDownloadOnAdd() const;
    void setStartDownloadOnAdd(bool start);
    
    // 保存和加载设置
    void saveSettings();
    void loadSettings();

private:
    QSettings *m_settings;
    
    // 下载设置
    int m_maxConcurrentDownloads;
    int m_downloadSpeedLimit;
    QString m_defaultDownloadPath;
    bool m_useProxy;
    QString m_proxyHost;
    int m_proxyPort;
    
    // 重试设置
    int m_maxRetries;
    
    // 用户界面设置
    bool m_showNotificationOnComplete;
    bool m_startDownloadOnAdd;
};

#endif // SETTINGSMANAGER_H